package com.fau.om.entity;

import java.io.Serializable;
import java.util.Date;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;

import org.apache.commons.lang3.time.DateFormatUtils;
import org.hibernate.annotations.GenericGenerator;
import org.json.simple.JSONAware;
import org.json.simple.JSONObject;

/**
 * @desc 订单搭销产品统计实体类
 * @author kangyj
 * @datetime 2014年12月12日,上午1:46:17
 */
@Entity
@Table(name = "medical_orders_ridepin_sta")
public class MedicalOrdersRidepinSta implements Serializable, JSONAware {

	private static final long serialVersionUID = 4621623890660522994L;

	private String id;
	private String ordersId;		// 订单id
	private String ordersNum;		// 订单编号
	private Date ordersTime;		// 下单时间
	private String productDetail;	// 产品明细
	private Integer productCount;	// 产品数
	private Integer mainProduct;	// 主要产品数
	private Integer ridePinProduct;	// 搭销产品数
	private String mediaId;			// 媒体id
	private String mediaName;		// 媒体名称
	private String hospitalId;		// 医院id
	private String cusSerId;		// 客服id
	private String startTime;		// 下单开始时间
	private String endTime;			// 下单结束时间
	
	private Date stime;
	private Date etime;
	
	@Id
	@GenericGenerator(name = "generator", strategy = "uuid.hex")
	@GeneratedValue(generator = "generator")
	@Column(name = "id", length = 32)
	public String getId() {
		return id;
	}

	public void setId(String id) {
		this.id = id;
	}

	@Column(name = "orders_id", length = 32)
	public String getOrdersId() {
		return ordersId;
	}

	public void setOrdersId(String ordersId) {
		this.ordersId = ordersId;
	}

	@Column(name = "orders_num", length = 20)
	public String getOrdersNum() {
		return ordersNum;
	}

	public void setOrdersNum(String ordersNum) {
		this.ordersNum = ordersNum;
	}

	@Column(name = "orders_time")
	public Date getOrdersTime() {
		return ordersTime;
	}

	public void setOrdersTime(Date ordersTime) {
		this.ordersTime = ordersTime;
	}

	@Column(name = "product_detail", length = 255)
	public String getProductDetail() {
		return productDetail;
	}

	public void setProductDetail(String productDetail) {
		this.productDetail = productDetail;
	}

	@Column(name = "product_count", length = 11)
	public Integer getProductCount() {
		return productCount;
	}

	public void setProductCount(Integer productCount) {
		this.productCount = productCount;
	}

	@Column(name = "main_product", length = 11)
	public Integer getMainProduct() {
		return mainProduct;
	}

	public void setMainProduct(Integer mainProduct) {
		this.mainProduct = mainProduct;
	}

	@Column(name = "ride_pin_product", length = 11)
	public Integer getRidePinProduct() {
		return ridePinProduct;
	}

	public void setRidePinProduct(Integer ridePinProduct) {
		this.ridePinProduct = ridePinProduct;
	}
	
	@Column(name = "media_id", length = 32)
	public String getMediaId() {
		return mediaId;
	}

	public void setMediaId(String mediaId) {
		this.mediaId = mediaId;
	}

	@Column(name = "media_name", length = 30)
	public String getMediaName() {
		return mediaName;
	}

	public void setMediaName(String mediaName) {
		this.mediaName = mediaName;
	}

	@Column(name = "hospital_id", length = 32)
	public String getHospitalId() {
		return hospitalId;
	}

	public void setHospitalId(String hospitalId) {
		this.hospitalId = hospitalId;
	}
	
	@Column(name = "cus_ser_id", length = 32)
	public String getCusSerId() {
		return cusSerId;
	}

	public void setCusSerId(String cusSerId) {
		this.cusSerId = cusSerId;
	}

	@Transient
	public String getStartTime() {
		return startTime;
	}

	public void setStartTime(String startTime) {
		this.startTime = startTime;
	}

	@Transient
	public String getEndTime() {
		return endTime;
	}

	public void setEndTime(String endTime) {
		this.endTime = endTime;
	}

	@Transient
	public Date getStime() {
		return stime;
	}

	public void setStime(Date stime) {
		this.stime = stime;
	}

	@Transient
	public Date getEtime() {
		return etime;
	}

	public void setEtime(Date etime) {
		this.etime = etime;
	}

	@SuppressWarnings("unchecked")
	@Override
	public String toJSONString() {
		JSONObject obj = new JSONObject();
		obj.put("ordersNum", ordersNum);
		obj.put("ordersTime", DateFormatUtils.format(ordersTime,"yyyy-MM-dd HH:mm:ss"));
		obj.put("productDetail", productDetail);
		obj.put("productCount", productCount);
		obj.put("mainProduct", mainProduct);
		obj.put("ridePinProduct", ridePinProduct);
		obj.put("mediaName", mediaName);
		
		return obj.toString();
	}

}
